<template>
  <div class="">
    <div class="page-filter mb10 fl">
      <el-form ref="filter" :model="filter" label-width="0">
        <el-form-item class="mr10 mb5 fl">
          <el-input v-model="filter.name" placeholder="姓名" size="small" clearable />
        </el-form-item>
        <el-form-item class="mr10 mb5 fl" style="width: 300px">
          <el-button size="small" @click="app.reset('filter')">清 空</el-button>
          <el-button type="primary" size="small" @click="getList">查 询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table v-loading="app.loading" class="search-table" :data="list" border fit highlight-current-row style="width: 100%;">
      <el-table-column label="序号" align="center" width="56px">
        <template slot-scope="{$index}">
          {{ $index + 1 }}
        </template>
      </el-table-column>
      <el-table-column label="姓名" width="120px" prop="nickname" />
      <el-table-column label="部门" width="150px" prop="dep_name" />
      <el-table-column label="职位" width="150px" prop="pos_name" />
      <el-table-column label="入职日期" align="center" width="110px" prop="induction_time" />
      <el-table-column label="转正日期" align="center" width="110px" prop="become_time" />
      <el-table-column label="申请日期" align="center" width="140px" prop="apply_time" />
      <el-table-column label="自我鉴定" min-width="260px" prop="evaluate" />
      <el-table-column label="备注" min-width="260px" prop="remark" />
    </el-table>
    <pagination v-show="filter.pageAll>0" :total="filter.pageAll" :page.sync="filter.pageCurrent" :limit.sync="filter.pageNumber" @pagination="getList" />
  </div>
</template>

<script>
import { becomes } from '@/api/personnel'
import Pagination from '@/components/Pagination'

export default {
  name: '',
  components: { Pagination },
  inject: ['app'],
  data() {
    return {
      list: [{name: ''}],
      dialog: {
        edit: {},
        title: '',
        type: ''
      },
      filter: {
        pageNumber: 10,
        pageCurrent: 1,
        pageAll: 1
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList(e) {
      this.app.loading = true
      becomes({
        ...this.filter,
        ...e
      }).then(response => {
        this.list = response.list
        this.filter = response.filter
        this.app.removeLoding()
      }).catch(err => {
        this.$message.error(err.msg)
      })
    }
  }
}
</script>
